<include file="Public:header" />
<div class="container">
	<!-- Docs nav ================================================== -->
	<div class="page-header" style="border:none; font-size:14px;">
		<ul class="nav nav-tabs">
		  <li><a  href="{:U('customer/index')}"><img src="__PUBLIC__/img/customer_icon.png"/>&nbsp; {:L('CUSTOMER')}</a></li>
		  <li><a  href="{:U('customer/index','content=resource')}"><img src="__PUBLIC__/img/customer_source_icon.png"/>&nbsp; {:L('CUSTOMER_POOL')}</a></li>
		  <li><a href="{:U('contacts/index')}"><img src="__PUBLIC__/img/contacts_icon.png"/> &nbsp;{:L('LINKMAN')}</a></li>
		  <li class="active"><a href="{:U('customer/cares')}"><img src="__PUBLIC__/img/cares_icon.png"/> &nbsp;{:L('cumtomer_care')}</a></li>
		  <li><a href="{:U('customer/analytics')}"><img src="__PUBLIC__/img/tongji.png"/> &nbsp;{:L('CLIENT_STATISTICS')}</a></li>
		  <!-- <li><a href="http://5kcrm.com/index.php?m=doc&a=index&id=27" target="_blank" style="font-size: 12px;color: rgb(255, 102, 0);"><img width="20px;" src="__PUBLIC__/img/help.png"/> {:L('HELP')}</a></li> -->
		</ul>
	</div>
	<include file="Public:alert" />
	<p class="view">
		<b>{:L('CARE_IS_THE_VIEW')}</b>
		<img src=" __PUBLIC__/img/by_owner.png"/> 
		<a href="{:U('customer/cares')}" <if condition="$Think.get.by eq null">class="active"</if>>{:L('ALL')}</a> |
		<a href="{:U('customer/cares','by=me')}" <if condition="$Think.get.by eq 'me'">class="active"</if>>{:L('I_AM_IN_CHARGE_OF_THE')}</a> | 
		<a href="{:U('customer/cares','by=sub')}" <if condition="$Think.get.by eq 'sub'">class="active"</if>>{:L('SUBORDINATES_RESPONSIBLE_FOR')}</a>  &nbsp;  &nbsp; 
		<i class="icon-th-list"></i>
		<a href="{:U('customer/cares','by=email')}" <if condition="$Think.get.by eq 'email'">class="active"</if>>{:L('EMAIL')}</a> | 
		<a href="{:U('customer/cares','by=phone')}" <if condition="$Think.get.by eq 'phone'">class="active"</if>>{:L('PHONE')}</a> |
		<a href="{:U('customer/cares','by=message')}" <if condition="$Think.get.by eq 'message'">class="active"</if>>{:L('NOTE')}</a> |
		<a href="{:U('customer/cares','by=other')}" <if condition="$Think.get.by eq 'other'">class="active"</if>>{:L('OTHER')}</a>  &nbsp;  &nbsp; 
		<img src="__PUBLIC__/img/by_time.png"/> 
		<a href="{:U('customer/cares','by=today')}" <if condition="$Think.get.by eq 'today'">class="active"</if>>{:L('TODAY_IS_CARE')}</a> | 
		<a href="{:U('customer/cares','by=week')}" <if condition="$Think.get.by eq 'week'">class="active"</if>>{:L('WEEK_IS_CARE')}</a> | 
		<a href="{:U('customer/cares','by=month')}" <if condition="$Think.get.by eq 'month'">class="active"</if>>{:L('MONTH_IS_CARE')}</a>  &nbsp;
		<a href="{:U('customer/cares','by=add')}" <if condition="$Think.get.by eq 'add'">class="active"</if>>{:L('RECENTLY_CREATED')}</a> | 
		<a href="{:U('customer/cares','by=update')}" <if condition="$Think.get.by eq 'update'">class="active"</if>>{:L('RECENT_UPDATES')}</a>
	</p>
	<div class="row">		
		<div class="span12">
			<ul class="nav pull-left">
				<li class="pull-left"><a id="delete"  class="btn" style="margin-right: 8px;"><i class="icon-remove"></i>{:L('DELETE')}</a></li>
				<li class="pull-left">
				<form class="form-inline" id="searchForm" action="{:U('customer/cares')}" method="get">
				<ul class="nav pull-left">			
				<li class="pull-left" >
					<select style="width:auto" id="field" onchange="changeCondition()" name="field">
						<option class="all" value="all">{:L('ALL_FIELDS')}</option>
						<option class="word" value="subject">{:L('CARE_THEME')}</option>
						<option class="date" value="care_time">{:L('DATE_OF_CARE')}</option>
						<option class="customer" value="customer_id">{:L('CUSTUMER')}</option>
						<option class="role" value="owner_role_id">{:L('OPERATOR')}</option>
						<option class="word" value="content">{:L('CARE_CONTENT')}</option>
						<option class="word" value="description">{:L('REMARK')}</option>
						<option class="date" value="create_time">{:L('CREATION_TIME')}</option>
						<option class="date" value="update_time">{:L('MODIFICATION_TIME')}</option>
					</select>&nbsp;&nbsp;
				</li>
				<li id="conditionContent" class="pull-left">
					<select id="condition" style="width:auto" name="condition" onchange="changeSearch()">
						<option value="contains">{:L('INCLUDE')}</option>
						<option value="not_contain">{:L('EXCLUSIVE')}</option>
						<option value="is">{:L('YES')}</option>
						<option value="isnot">{:L('ISNOT')}</option>						
						<option value="start_with">{:L('BEGINNING_CHARACTER')}</option>
						<option value="end_with">{:L('TERMINATION_CHARACTER')}</option>
						<option value="is_empty">{:L('MANDATORY')}</option>
						<option value="is_not_empty">{:L('ISNOTEMPTY')}</option>
					</select>&nbsp;&nbsp;
				</li>
				<li id="searchContent" class="pull-left">
					<input id="search" type="text" class="input-medium search-query" name="search"/>&nbsp;&nbsp;
				</li>
				<li class="pull-left">
					<input type="hidden" name="m" value="customer"/><input type="hidden" name="a" value="cares"/>
					<if condition="$Think.get.by neq null"><input type="hidden" name="by" value="{$Think.get.by}"/></if>
					<button type="submit" class="btn"> <img src="__PUBLIC__/img/search.png"/>  {:L('SEARCH')}</button>
				</li>
				</ul>
			</form></li>
			</ul>
			<div class="pull-right">
				<a href="{:U('customer/caresadd')}" class="btn btn-primary"><i class="icon-plus">&nbsp; {:L('A_NEW_CONCERN')}</i></a>
			</div>
		</div>
		<div class="span12">
			<form id="form1" action="" method="post">
				<table class="table table-hover table-striped table_thead_fixed">
					<if condition="$caresList eq null">
						<tr><td>----{:L('TEMPORARILY_NO_DATA')}----</td></tr>
					<else/>
					<thead>
						<tr>
							<th><input type="checkbox" id="check_all"/></th>
							<th>{:L('CARE_THEME')}</th>
							<th>{:L('CUSTOMER')}</th>
							<th>
								<if condition="$_GET['asc_order'] == 'create_time'">
									<a href="{:U('customer/cares','desc_order=create_time&'.$parameter)}">
										{:L('DATE_OF_CARE')}&nbsp;<img src="__PUBLIC__/img/arrow_up.png">
									</a>
								<elseif condition="$_GET['desc_order'] == 'create_time'"/>
									<a href="{:U('customer/cares','asc_order=create_time&'.$parameter)}">
										{:L('DATE_OF_CARE')}&nbsp;<img src="__PUBLIC__/img/arrow_down.png">
									</a>
								<else/>
									<a href="{:U('customer/cares','desc_order=create_time&'.$parameter)}">{:L('DATE_OF_CARE')}</a>
								</if>
							</th>
							<th>{:L('EXECUTOR')}</th>							
							<if condition="C('ismobile') neq 1"><th>{:L('FOUNDER')}</th></if>
							<th>{:L('OPERATION')}</th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<td colspan="7">{$page}</td>
						</tr>
					</tfoot>
					<tbody>
						<volist name="caresList" id="vo">
							<tr>
								<td>
									<input name="care_id[]" class="check_list" type="checkbox" value="{$vo.care_id}"/>
								</td>
								<td><a href="{:U('customer/caresview', 'id='.$vo['care_id'])}">{$vo.subject}</a></td>
								<td>{$vo.customer.name}</td>
								<if condition="C('ismobile') neq 1"><td>{$vo.care_time|date='Y-m-d',###}</td></if>
								<td><notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty></td>
								<if condition="C('ismobile') neq 1"><td>
									<notempty name="vo.creator.user_name"><a class="role_info" rel="{$vo.creator.role_id}" href="javascript:void(0)">{$vo.creator.user_name}</a></notempty>
								</td></if>
								<td>
									<a href="{:U('customer/caresview', 'id='.$vo['care_id'])}">{:L('CHECK')}</a>
									<a href="{:U('customer/caresedit', 'id='.$vo['care_id'])}">{:L('COMPILE')}</a>
								</td>
							</tr>
						</volist>
					</tbody>
					</if>
				</table>
			</form>
		</div>
	</div>
</div>
<div class="hide" id="dialog-role-info" title="{:L('EMPLOYEE_INFORMATION')}">loading...</div>
<script type="text/javascript">
$("#dialog-role-info").dialog({
    autoOpen: false,
    modal: true,
	width: 600,
	maxHeight: 400,
	position: ["center",100]
});
$(function(){
<if condition="$Think.get.field neq null">
	$("#field option[value='{$Think.get.field}']").prop("selected", true);changeCondition();
	$("#condition option[value='{$Think.get.condition}']").prop("selected", true);changeSearch();
	$("#search").prop('value', '{$Think.get.search}');
</if>

	$("#check_all").click(function(){
		$("input[class='check_list']").prop('checked', $(this).prop("checked"));
	});
	$('#delete').click(function(){
		if(confirm("{:L('ARE_YOU_SRUE_DELETE')}")){
			$("#form1").attr('action', '{:U("customer/caresdelete")}');
			$("#form1").submit();
		}
	});
	$(".role_info").click(function(){
		$role_id = $(this).attr('rel');
		$('#dialog-role-info').dialog('open');
		$('#dialog-role-info').load('{:U("user/dialoginfo","id=")}'+$role_id);
	});
});
</script>
<include file="Public:footer" />